import Observer from '../src/observer.js'

var obj = {
    name: "kate",
    age: 18,
    like:['sing', 'swing', {
        times: 'dayli'
    }],
    car: {
        brand: "bmw",
        price: "200w",
        
    },
}
window.obs1 = new Observer(obj)
let subscribe1 = obs1.subscribe("car", ({path, value}) => {
    console.log(path, "change", value)
})
let subscribe2 = obs1.subscribe("name", ({path, value}) => {
    console.log(path, "change", value)
})
let subscribe3 = obs1.subscribe("like[2].times", ({path, value}) => {
    console.log(path, "change", value)
})
// obs1.disSubscribe(subscribe1)
obs1.data.car.brand = "tesla"
obs1.data.name = "lili"
obs1.data.like[2].times = "hhh"
